const routes = [
  {
    path: "",
    component: () => import("pages/IndexPage.vue"),
  },
  {
    path: "/",
    component: () => import("layouts/MainLayout.vue"),
    children: [
      {
        path: "demand-list",
        components: {
          header: () => import("components/headers/DemandHeader.vue"),
          default: () => import("pages/DemandListPage.vue"),
        },
        meta: { needAccount: true, keepAlive: true, title: "需求大厅" },
      },
      {
        path: "chance",
        components: {
          header: () => import("components/headers/ChanceHeader.vue"),
          default: () => import("pages/ChancePage.vue"),
        },
        meta: { needAccount: true, keepAlive: true, title: "商机" },
      },
      {
        path: "server",
        component: () => import("pages/ServerPage.vue"),
        meta: { needAccount: true, keepAlive: true },
      },
      {
        path: "detail/:id(\\d+)",
        component: () => import("pages/DetailPage.vue"),
        meta: { title: "需求详情" },
      },
      {
        path: "browser",
        components: {
          header: () => import("components/headers/AccountsHeader.vue"),
          default: () => import("pages/BrowserPage.vue"),
        },
        meta: { needAccount: true, keepAlive: true },
      },
      { path: "iframe", component: () => import("pages/IframePage.vue") },
      {
        path: "accounts",
        component: () => import("pages/AccountsPage.vue"),
      },
      { path: "wallet", component: () => import("pages/WalletPage.vue") },
      {
        path: "payment/:id(\\d+)?",
        component: () => import("pages/PaymentPage.vue"),
      },
    ],
  },
  {
    path: "/page",
    component: () => import("layouts/CommonLayout.vue"),
    children: [
      {
        path: "settings",
        component: () => import("pages/SettingsPage.vue"),
        meta: { title: "设置" },
      },
      {
        path: "login",
        component: () => import("pages/LoginPage.vue"),
        meta: { title: "设置" },
      },
      {
        path: "update",
        component: () => import("pages/UpdatePage.vue"),
        meta: { title: "更新" },
      },
    ],
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: "/:catchAll(.*)*",
    component: () => import("pages/ErrorNotFound.vue"),
  },
];

export default routes;
